//
//  LZBannerView.h
//  Project
//
//  Created by liting on 2025/8/29.
//

#import <UIKit/UIKit.h>
#import "BannerModel.h"

NS_ASSUME_NONNULL_BEGIN

@class LZBannerView;

@protocol LZBannerViewDelegate <NSObject>

@optional
/**
 点击banner回调

 @param bannerView banner视图
 @param banner 点击的banner数据
 @param index 点击的索引
 */
- (void)bannerView:(LZBannerView *)bannerView didSelectBanner:(BannerModel *)banner atIndex:(NSInteger)index;

/**
 banner滚动回调

 @param bannerView banner视图
 @param index 滚动到的索引
 */
- (void)bannerView:(LZBannerView *)bannerView didScrollToIndex:(NSInteger)index;

@end

@interface LZBannerView : UIView

@property (nonatomic, weak) id<LZBannerViewDelegate> delegate;

/// 是否自动滚动，默认YES
@property (nonatomic, assign) BOOL autoScroll;
/// 自动滚动时间间隔，默认3秒
@property (nonatomic, assign) NSTimeInterval autoScrollInterval;
/// 是否显示页码指示器，默认YES
@property (nonatomic, assign) BOOL showPageControl;
/// 是否无限循环，默认YES
@property (nonatomic, assign) BOOL infiniteLoop;
/// 占位图
@property (nonatomic, strong) UIImage *placeholderImage;
/// 当前页码颜色
@property (nonatomic, strong) UIColor *currentPageDotColor;
/// 其他页码颜色
@property (nonatomic, strong) UIColor *pageDotColor;
/// banner图片填充模式
@property (nonatomic, assign) UIViewContentMode imageContentMode;

/**
 便捷初始化方法

 @param frame frame
 @param delegate 代理
 @return banner视图实例
 */
+ (instancetype)bannerViewWithFrame:(CGRect)frame delegate:(id<LZBannerViewDelegate>)delegate;

/**
 设置banner数据

 @param banners banner模型数组
 */
- (void)setBanners:(NSArray<BannerModel *> *)banners;

/**
 开始自动滚动
 */
- (void)startAutoScroll;

/**
 停止自动滚动
 */
- (void)stopAutoScroll;

/**
 重新加载数据
 */
- (void)reloadData;

@end

NS_ASSUME_NONNULL_END
